﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Lucene.Net.Index;

namespace LynxWiki.DomainModel
{
    // ensures that web interface does not require reference to Lucene.Net.Index
    public class IndexStatus
    {
        public bool CantOpenSegments { get; set; }
        public bool Clean { get; set; }
        public List<string> Dir { get; set; }
        public bool MissingSegments { get; set; }
        public bool MissingSegmentsVersion { get; set; }
        public int NumBadSegments { get; set; }
        public int NumSegments { get; set; }
        public bool Partial { get; set; }
        public string SegmentFormat { get; set; }
        public List<string> SegmentsChecked { get; set; }
        public string SegmentsFileName { get; set; }
        public bool ToolOutOfDate { get; set; }
        public int TotLoseDocCount { get; set; }
        public IDictionary<string, string> UserData { get; set; }

        public IndexStatus(CheckIndex.Status status)
        {
            CantOpenSegments = status.cantOpenSegments;
            Clean = status.clean;
            Dir = status.dir.ListAll().ToList();
            MissingSegments = status.missingSegments;
            MissingSegmentsVersion = status.missingSegmentVersion;
            NumBadSegments = status.numBadSegments;
            NumSegments = status.numSegments;
            Partial = status.partial;
            SegmentFormat = status.segmentFormat;
            //status.segmentInfos;
            SegmentsChecked = status.segmentsChecked;
            SegmentsFileName = status.segmentsFileName;
            ToolOutOfDate = status.toolOutOfDate;
            TotLoseDocCount = status.totLoseDocCount;
            UserData = status.userData;
        }
    }
}
